/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EditorPacienteDlg.java
 *
 * Created on 05-ene-2012, 0:57:53
 */
package vista.personas.pacientes;

import java.util.Collection;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTextField;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeSelectionModel;
import util.GestorComponenteVista;
import util.components.IntegerTextField;
import util.validation.annotation.*;

/**
 *
 * @author Raul
 */
public class EditorParienteDlg extends javax.swing.JDialog {
     
    private GestorVistaParienteDlg gestorVista;
    
    /** Creates new form EditorPeofesionalDlg */
    public EditorParienteDlg(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(null);
    }
    
    public EditorParienteDlg( GestorVistaParienteDlg gestorVista) {
        super();
        this.gestorVista = gestorVista;
        initComponents();
        setLocationRelativeTo(null);
    }
    
    public GestorVistaParienteDlg getGestorVista() {
        return gestorVista;
    }

    public void setGestorVista(GestorVistaParienteDlg gestorVista) {
        this.gestorVista = gestorVista;
    }
    
    @Grupo
    @Filter
    @NotEmpty
    public JTextField getNombreTxt() {
        return nombreTxt;
    }
    
    @Grupo
    @Filter
    @NotEmpty
    public JTextField getApellidoTxt() {
        return apellidoTxt;
    }
    
    @Grupo
    @Filter
    @NotEmpty
    public IntegerTextField getNroDocumentoTxt() {
        return nroDocumentoTxt;
    }
    
    @NotEmpty
    public JComboBox getSexoCmb() {
        return sexoCmb;
    }
    
    @NotEmpty
    public JList getEnfermedadesLst() {
        return enfermedadesLst;
    }
    
    @NotEmpty
    public JComboBox getParentescoCmb() {
        return parentescoCmb;
    }

    public JLabel getEsPacienteLbl() {
        return esPacienteLbl;
    }
    
    public void cargarComboParentescos(Collection parentescos) {
        GestorComponenteVista.cargarCombo(parentescoCmb, parentescos);
    }
    
    void crearModeloArbol(TreeModel model) {
        GestorComponenteVista.crearModeloArbol(enfermedadesTree, model);
    }

    void agregarNodoArbol(Object padre, Object hijo) {
        if (!GestorComponenteVista.contiene(enfermedadesLst, hijo)) {
            GestorComponenteVista.agregarNodoArbol(enfermedadesTree, padre, hijo);
        }
    }
    
    void quitarNodoArbol(Object hoja) {
        GestorComponenteVista.quitarNodoArbol(enfermedadesTree, hoja);
    }
    
    void cargarListaEnfermedades(Collection enfermedades) {
        GestorComponenteVista.cargarLista(enfermedadesLst, enfermedades);
    }
    
    void setEdicionPersonaHabilitada(boolean bool) {
        nombreTxt.setEnabled(bool);
        apellidoTxt.setEnabled(bool);
        nroDocumentoTxt.setEnabled(bool);
        sexoCmb.setEnabled(bool);
        agregarEnfermedadBtn.setEnabled(bool);
        quitarEnfermedadBtn.setEnabled(bool);
    }
    
    void setBusquedaPermitida(boolean bool) {
        buscarPersonaBtn.setEnabled(bool);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gradientPanel1 = new util.components.GradientPanel();
        jLabel3 = new javax.swing.JLabel();
        sexoCmb = new javax.swing.JComboBox();
        jPanel1 = new javax.swing.JPanel();
        nroDocumentoTxt = new util.components.IntegerTextField();
        buscarPersonaBtn = new javax.swing.JButton();
        apellidoTxt = new util.components.CamelCaseTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        nombreTxt = new util.components.CamelCaseTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        parentescoCmb = new javax.swing.JComboBox();
        roundedTitlePanel1 = new util.components.RoundedTitlePanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        enfermedadesTree = new javax.swing.JTree();
        buscarEnfermedadTxt = new javax.swing.JTextField();
        buscarEnfermedadBtn = new javax.swing.JButton();
        quitarEnfermedadBtn = new javax.swing.JButton();
        agregarEnfermedadBtn = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        enfermedadesLst = new javax.swing.JList();
        esPacienteLbl = new javax.swing.JLabel();
        cancelarBtn = new javax.swing.JButton();
        listoBtn = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Editar Pariente");
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setModal(true);
        setResizable(false);

        gradientPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.lightGray));
        gradientPanel1.setGradientColor1(java.awt.Color.white);
        gradientPanel1.setGradientColor2(javax.swing.UIManager.getDefaults().getColor("Panel.background"));

        jLabel3.setText("Sexo");

        sexoCmb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "Hombre", "Mujer" }));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel1.setOpaque(false);

        nroDocumentoTxt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                nroDocumentoTxtKeyTyped(evt);
            }
        });

        buscarPersonaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/zoom.png"))); // NOI18N
        buscarPersonaBtn.setText("Buscar");
        buscarPersonaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buscarPersonaBtnActionPerformed(evt);
            }
        });

        jLabel2.setText("Apellido");

        jLabel1.setText("Nombre");

        jLabel5.setText("Nro Documento");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addGap(58, 58, 58)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(60, 60, 60)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(nombreTxt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                        .addComponent(buscarPersonaBtn)
                        .addComponent(apellidoTxt, javax.swing.GroupLayout.Alignment.LEADING))
                    .addComponent(nroDocumentoTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nroDocumentoTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(nombreTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(apellidoTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(buscarPersonaBtn)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel4.setText("Parentesco");

        parentescoCmb.setModel(new javax.swing.DefaultComboBoxModel());

        roundedTitlePanel1.setOpaque(false);
        roundedTitlePanel1.setTitle("Enfermedades");

        enfermedadesTree.setRootVisible(false);
        enfermedadesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        jScrollPane1.setViewportView(enfermedadesTree);

        buscarEnfermedadTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buscarEnfermedadBtnActionPerformed(evt);
            }
        });

        buscarEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/zoom.png"))); // NOI18N
        buscarEnfermedadBtn.setToolTipText("Buscar Enfermedad");
        buscarEnfermedadBtn.setBorderPainted(false);
        buscarEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buscarEnfermedadBtnActionPerformed(evt);
            }
        });

        quitarEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowLeft_24.png"))); // NOI18N
        quitarEnfermedadBtn.setText("Quitar");
        quitarEnfermedadBtn.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        quitarEnfermedadBtn.setIconTextGap(6);
        quitarEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitarEnfermedadBtnActionPerformed(evt);
            }
        });

        agregarEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowRight_24.png"))); // NOI18N
        agregarEnfermedadBtn.setText("Agregar");
        agregarEnfermedadBtn.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        agregarEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agregarEnfermedadBtnActionPerformed(evt);
            }
        });

        enfermedadesLst.setModel(new javax.swing.DefaultListModel());
        enfermedadesLst.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(enfermedadesLst);

        javax.swing.GroupLayout roundedTitlePanel1Layout = new javax.swing.GroupLayout(roundedTitlePanel1);
        roundedTitlePanel1.setLayout(roundedTitlePanel1Layout);
        roundedTitlePanel1Layout.setHorizontalGroup(
            roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(roundedTitlePanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, roundedTitlePanel1Layout.createSequentialGroup()
                        .addComponent(buscarEnfermedadTxt)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(buscarEnfermedadBtn))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(agregarEnfermedadBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                    .addComponent(quitarEnfermedadBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        roundedTitlePanel1Layout.setVerticalGroup(
            roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(roundedTitlePanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(buscarEnfermedadBtn)
                    .addComponent(buscarEnfermedadTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(roundedTitlePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(roundedTitlePanel1Layout.createSequentialGroup()
                        .addComponent(agregarEnfermedadBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(quitarEnfermedadBtn)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE))
                .addContainerGap())
        );

        esPacienteLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/patient_48.png"))); // NOI18N
        esPacienteLbl.setText("Paciente");
        esPacienteLbl.setVisible(false);

        javax.swing.GroupLayout gradientPanel1Layout = new javax.swing.GroupLayout(gradientPanel1);
        gradientPanel1.setLayout(gradientPanel1Layout);
        gradientPanel1Layout.setHorizontalGroup(
            gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gradientPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(roundedTitlePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(gradientPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(gradientPanel1Layout.createSequentialGroup()
                                .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4))
                                .addGap(38, 38, 38)
                                .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(sexoCmb, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(parentescoCmb, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(esPacienteLbl))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        gradientPanel1Layout.setVerticalGroup(
            gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gradientPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(gradientPanel1Layout.createSequentialGroup()
                        .addComponent(esPacienteLbl)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(sexoCmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(gradientPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(parentescoCmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(roundedTitlePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        cancelarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cancel.png"))); // NOI18N
        cancelarBtn.setText("Cancelar");
        cancelarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarBtnActionPerformed(evt);
            }
        });

        listoBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/accept.png"))); // NOI18N
        listoBtn.setText("Listo");
        listoBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                listoBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(gradientPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(listoBtn)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cancelarBtn)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(gradientPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(listoBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cancelarBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cancelarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarBtnActionPerformed
        dispose();
    }//GEN-LAST:event_cancelarBtnActionPerformed

    private void listoBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listoBtnActionPerformed
        gestorVista.guardar();
    }//GEN-LAST:event_listoBtnActionPerformed

    private void buscarEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buscarEnfermedadBtnActionPerformed
        gestorVista.buscarEnfermedad(buscarEnfermedadTxt.getText());
        GestorComponenteVista.expandirArbol(enfermedadesTree);
    }//GEN-LAST:event_buscarEnfermedadBtnActionPerformed

    private void agregarEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agregarEnfermedadBtnActionPerformed
        if (!enfermedadesTree.isSelectionEmpty()
                && GestorComponenteVista.isHojaSeleccionada(enfermedadesTree)){
            Object objetoSeleccionado = GestorComponenteVista.getObjetoSeleccionado(enfermedadesTree);
            GestorComponenteVista.agregarDatoLista(enfermedadesLst, objetoSeleccionado);
            this.quitarNodoArbol(objetoSeleccionado);
        }
    }//GEN-LAST:event_agregarEnfermedadBtnActionPerformed

    private void quitarEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitarEnfermedadBtnActionPerformed
        if (!enfermedadesLst.isSelectionEmpty()){
            GestorComponenteVista.quitarDatoLista(enfermedadesLst, enfermedadesLst.getSelectedIndex());
        }
    }//GEN-LAST:event_quitarEnfermedadBtnActionPerformed

    private void nroDocumentoTxtKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nroDocumentoTxtKeyTyped
        if (nroDocumentoTxt.getText().length() ==  8) evt.consume();
    }//GEN-LAST:event_nroDocumentoTxtKeyTyped

    private void buscarPersonaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buscarPersonaBtnActionPerformed
        gestorVista.buscarPersona();
    }//GEN-LAST:event_buscarPersonaBtnActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EditorParienteDlg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EditorParienteDlg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EditorParienteDlg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EditorParienteDlg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                EditorParienteDlg dialog = new EditorParienteDlg(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton agregarEnfermedadBtn;
    private javax.swing.JTextField apellidoTxt;
    private javax.swing.JButton buscarEnfermedadBtn;
    private javax.swing.JTextField buscarEnfermedadTxt;
    private javax.swing.JButton buscarPersonaBtn;
    private javax.swing.JButton cancelarBtn;
    private javax.swing.JList enfermedadesLst;
    private javax.swing.JTree enfermedadesTree;
    private javax.swing.JLabel esPacienteLbl;
    private util.components.GradientPanel gradientPanel1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton listoBtn;
    private javax.swing.JTextField nombreTxt;
    private util.components.IntegerTextField nroDocumentoTxt;
    private javax.swing.JComboBox parentescoCmb;
    private javax.swing.JButton quitarEnfermedadBtn;
    private util.components.RoundedTitlePanel roundedTitlePanel1;
    private javax.swing.JComboBox sexoCmb;
    // End of variables declaration//GEN-END:variables
    
}
